<?php
namespace Home\Model;
use Think\Model;
class LoginModel extends Model {
    protected $tableName = "information";

    protected $_validate = array(
        array('phone','require','手机号必须填写'),
        array('password','require','密码必须填写')
    );

    function Login(){
        $input = $this->create();
        if( empty($input)){
            return;
        }
        $dbData =  $this->getByPhone($input['phone']);
        if(empty($dbData)){
            $this->error ="用户不存在!";
            return;
        }
        $zx = md5($input['password']).'cj';

        if($dbData['password']!=$zx){
            $this->error ="密码错误！!";
            return;
        }
        return $dbData;
    }

}